<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <title>日志列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="/pc/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/font_eolqem241z66flxr.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/news.css" media="all" />
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search" style="margin-top:1.2em;">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input type="text" value="" placeholder="请输入关键字" class="layui-input search_input">
        </div>
        <a class="layui-btn search_btn">查询</a>
    </div>
    <div class="layui-inline">
        <a class="layui-btn linksAdd_btn" style="background-color:#161917;">添加</a>
    </div>
</blockquote>
<div class="layui-form links_list">
    <table class="layui-table">
        {{csrf_field()}}
        <thead>
        <tr>
            <th>编号</th>
            <th>平台</th>
            <th>区域</th>
            <th>建筑</th>
            <th>房间</th>
            <th>状态</th>
        </tr>
        </thead>
        <tbody class="links_content">
        @if(!empty($data))
            @foreach($data as $val)
                <tr >
                    <td>{{$val['id']}}</td>
                    <td>{{$val['operator']}}</td>
                    <td>
                        <input type="checkbox" name="noti_area" key="{{$val['id']}}" lay-skin="switch" lay-text="是|否" @if($val['noti_area'] == 1) checked @endif value="{{$val['noti_area']}}" lay-filter="isShow">
                        <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em>否</em><i></i></div>
                    </td>
                    <td>
                        <input type="checkbox" name="noti_building" key="{{$val['id']}}" lay-skin="switch" lay-text="是|否" @if($val['noti_building'] == 1) checked @endif value="{{$val['noti_building']}}" lay-filter="isShow">
                        <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em>否</em><i></i></div>
                    </td>
                    <td>
                        <input type="checkbox" name="noti_room" key="{{$val['id']}}" lay-skin="switch" lay-text="是|否" @if($val['noti_room'] == 1) checked @endif value="{{$val['noti_room']}}" lay-filter="isShow">
                        <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em>否</em><i></i></div>
                    </td>
                    <td>
                        <input type="checkbox" name="status" key="{{$val['id']}}" lay-skin="switch" lay-text="是|否" @if($val['status'] == 1) checked @endif value="{{$val['status']}}" lay-filter="isShow">
                        <div class="layui-unselect layui-form-switch" lay-skin="_switch"><em>否</em><i></i></div>
                    </td>
                </tr>
            @endforeach
        @endif
        </tbody>
    </table>
</div>
<div id="page"></div>
<script type="text/javascript" src="/pc/layui/layui.js"></script>
</body>
<script type="text/javascript">
layui.config({
    base : "js/"
}).use(['form','layer','jquery','layedit','laydate'],function(){
    var form = layui.form(),
        layer = parent.layer === undefined ? layui.layer : parent.layer,
        $ = layui.jquery;

    form.on("switch(isShow)",function(data){
        if(data.elem.checked){
            $(this).val('1');
            var val = 1;
        }else{
            $(this).val('0');
            var val = 0;
        }

        $.ajax({
            type:'post',
            url:'/admin/notiset/update',
            async:false,
            data:{
                '_token':$('input[name=_token]').val(),
                'id':$(this).attr('key'),
                'set':$(this).attr('name'),
                'val':val
            },
            dataType:'json',
            success:function (data) {

            }
        })
    })
})
</script>
</html>